home *** CD-ROM | disk | FTP | other *** search
/ Amiga Mag HDD Backup / Amiga Mag HDD Backup.zip / Amiga Mag HDD Backup / Alexander.img.bin / Alexander.img / 315 2 files Archive.sit / Any plain-text files / ? Any plain-text file 82 < prev    next >
Text File  |  1995-01-03  |  13KB  |  2 lines

  1. r loaded into CanDo. In order to executethe deck, two files supplied by CanDo must be available,DeckRunner and CanDo.library. DeckRunner is a program that CanDoinstalls in the C: directory of the system disk. By setting thedefault tool of the CanDo deck project file to DeckRunner, theCanDo deck can be executed without using CanDo itself.CanDo.library is the shared library file used by CanDo whenrunning a deck. Be aware that CD_ADE allows some modificationsto the text file that extends the capabilities of a CanDo deckbut makes it impossible to edit within CanDo. In these cases,CD_ADE would be used as the final step in creating the program.This will be discussed in more detail later.What is Required to Run CD_ADE?    The program documentation states that you need the followingAmiga environment to properly execute CD_ADE: CanDo 2.5x orgreater, AmigaDOS 2.0 or higher, minimum 512 KB fast memory, andless than 100 KB of floppy or hard drive space. The main reasonfor needing CanDo 2.5x is for access to DeckRunner andCanDo.library. These files are not freely distributable and canonly be obtained legally as part of the CanDo package.    You will probably find it easier to create your program withCanDo and then use CD_ADE for editing and adding a few finaltouches. However, this is not necessary. A text file containingAV1 code can be created from scratch with an editor and thenconverted with CD_ADE. AV1 is the underlying language used byCanDo. In fact, it is the language with which CanDo itself iswritten. AV1 code is a part of what you see when you print a deckwith ThePrinter utility. I use this utility to create the programlistings for my CanDo tutorial series.    Although CD_ADE is suppose to work with CanDo 2.5x orhigher, I suspect that if an enhanced version of CanDo comes outlater, CD_ADE would not support any new features of the newversion. It would have to be upgraded also in order to handle thenew features.How Does CD_ADE Work?    CD_ADE and all its support files come on one floppy disk. Itis very simple to install on a hard drive. Just create a CD_ADEdirectory and move all of the files from the floppy disk to thisdirectory. As stated earlier, CD_ADE can also be executed from afloppy disk.    When the CD_ADE program begins execution, it opens a windowon the Workbench screen (lower left of Figure 1). At this pointthere are four ways you can pass a file to the program: drag anddrop a file icon into the CD_ADE window, select a file name froma file requester, send a command to the CD_ADE ARexx port, orexecute the CD_ADE_AREXX CLI command. The latter method has theadded advantage that if CD_ADE is not currently running, it willbe started.    When CD_ADE receives the name of a file to load, it checksto see what type of file it is. If it is a CanDo project file, itis converted to an AV1 text file. If it is an AV1 text file, itis converted to a CanDo project file. Messages are displayed inthe CD_ADE window to let you know how it is proceeding. Themessages keep building up in the window until the tiny buttonwith a C in it (extreme lower right corner of the window) ispressed.What About the Details?    To illustrate how CD_ADE works, I wrote a very simpleutility named CanDoTextReader using CanDo. The interface is shownin the middle of Figure 1 and a listing generated by ThePrinterutility is in Listing 1. The CanDoTextReader deck is quite small,containing one card that has a memo object and a text button onit.    The card in this deck is named TextReader. Notice that thewindow associated with the card has a resizing gadget in thelower right corner. The card has a BeforeAttachment script thatdoes nothing but create a document named TextDoc. This documentis associated with the memo object which is named FileMemo.    The text button is named SelectFile. It has an OnReleaseevent script that opens a file requester, allows a file to beselected, opens the file, determines it size, reads the file intoa string variable named TextVar, closes the file, clears thedocument, types TextVar into the document, and then moves thecursor to the top of the document. At this point, the contents ofthe file will be shown in the FileMemo memo object.    When the CanDoTextReader project icon is dragged to theCD_ADE window, CD_ADE converts the project file to an AV1 textfile named CanDoTextReader.z (see Listing 2). This text file canbe loaded into an editor for modification. After changing thefile, it can be saved as CanDoTextReader.zi. When this file isprocessed by CD_ADE, the old CanDoTextReader project file isreplaced with a new one based on the modified AV1 file. Also, ifany CD_ADE directives are added to the file that require textsubstitution, the CanDoTextReader.z file is used as a work fileand is thus overwritten. If you do not wish for these files to beoverwritten, save the .zi file with a different name.So What Can I Do With CD_ADE That I Can't Do With CanDo?    Have you ever noticed that CanDo seems to be able toperform tasks that it will not allow you to do in your ownprograms? The reason for this is that CanDo does not giveprogrammers access to the full power of the AV1 language. Byworking with the AV1 language directly in an editor and thenconverting the AV1 file to a project file with CD_ADE, more ofthe power of AV1 is opened up. To give you a small taste of thispower, I took the CanDoTextReader deck project file, converted itto an AV1 text file, renamed it to CDADETextReader, modified it,and then converted the modified file to a project file. TheCDADETextReader.zi file is shown in Listing 3. Before discussingit, let's take another look at CanDoTextReader.    As I pointed out before, the TextReader card's window has aresizing gadget on it (see Figure 1). What happens when youresize the window? Well, the window has an OnResized eventscript. It simply moves the SelectFile text button to the bottomcenter of the newly resized window using the MoveObject command.However, there is a problem. When the button is moved, theimagery of the old button does not go away. After resizing thewindow several times, it will look something like Figure 2. Theonly way to make the old imagery go away is to refresh the cardwith a GotoCard command. But this creates another problem. Thewindow snaps back to its original design size rather than thesize you selected. The same thing happens if you move the windowto a new position and then refresh the card. You could try savingthe current position (WindowX and WindowY system variables) andsize (WindowWidth and WindowHeight system variables) of thewindow in the OnResized script, reactivating the card, and thenpositioning and sizing the window in the card's AfterAttachmentscript using the MoveWindow and ResizeWindow commands. However,the ResizeWindow command causes the OnResized script to execute,which in turn reactivates the card, and so on forever. This meansflag variables have to be used. I tried several ways toaccomplish this and was never successful.    In addition to the text button position problem, how do yougo about resizing the memo object when the window is resized?After all, you are probably resizing the window so you can seemore text in the memo field. CanDo only allows you to set thesize of an object at design time. This information resides in thedefinition area of an object.    The solution to all the above problems is to use variablesfor the window's position and size, the text button's position,and the memo object's size. This is allowed by AV1 but cannot bedone within the CanDo programming environment.How Does CDADETextReader Work?    Look at the definition sections of the window, button, andmemo object in Listing 3. The variable names used for thewindow's origin are WX and WY. The window's width and height arestored in WW and WH. The button's X and Y positions usecalculated quantities involving the system variables WindowWidthand WindowHeight. The same is true for the memo object's size.Since all the variables representing the window's position andsize have an initial value of zero, they must be assignedappropriate values before the window is displayed. The card'sBeforeAttachment script executes before the window is displayedand is the ideal place to make the assignments. However, theassignments should only be made once to prevent the window fromjumping back to its original position and size whenever the cardis reactivated. Thus, the assignments are only made whenInvocation is equal to zero. Afterwards, Invocation is assigned avalue of one to prevent the assignments from being made again.Remember this little trick. It comes in handy quite a bit.    When the window is resized, the OnResized event scriptreassigns WX, WY, WW, and WH based on the current values ofWindowX, WindowY, WindowWidth, and WindowHeight, and thenreactivates the card. Since the window's position and size arebased on variables, rather than constants, the newly refreshedcard will maintain its new settings. Also, when the text buttonand memo object are attached, they will be positioned and sizedbased on the current window size. Figure 3 shows CDADETextReaderwith its original position and size. The CDADETextReader.zi fileis displayed in the memo object. Figure 4 shows the window aftermoving and resizing it. Isn't this GREEEEAAAAT? Thisfunctionality could be useful in many applications.What Else Can CD_ADE Do?    Look at the first three lines of TextReader'sBeforeAttachment script. The first line is a regular CanDocomment. However, the next two lines are CD_ADE directives. TheLet statement tells CD_ADE to insert the version informationafter the semi-colon into the project file such that it can beretrieved with the AmigaDOS Version command. CD_ADE will insertthe current date and time in the format YYMMDD.HHMMSS as well asthe version information. The documentation mentions that Versionseems to have a problem displaying more than 30 characters whenspaces are in the string. I had problems displaying any versioninformation regardless of size; only the date and timeinformation appears. I have not yet solved this problem.    The comment statement containing the string "CD_ADE_Icons =True" tells CD_ADE to create icons for the project file, the .zfile, and the .zi file. You can see these in the lower right ofFigure 1. There is one problem with the icon used for the projectfile. It does not have a default tool of DeckRunner already set.It must be set by the programmer. However, the icon file used forproject files resides in the Resources subdirectory of the CD_ADEdirectory. It is named deck.info. By adding a default tool ofDeckRunner to this icon, all future project files willautomatically have this set.    If the directive "; CD_ADE_NoComments = TRUE" is found inan AV1 file, CD_ADE will remove all comments in the file beforecreating a project file. This can be used to reduce the size of aproject file when the program is complete.    CD_ADE also allows a ##INCLUDE statement to reside anywherewithin an AV1 file. It looks like this: ##INCLUDEdh0:MyDir/MyFile. When this directive is encountered, MyFile isinserted into the AV1 file. This allows generic reusable code tobe saved in a file and then included in any AV1 program thatneeds it.    Since AV1 is a hierarchical language (a deck has a cardwhich has objects), some interesting combinations can be dreamedup. In AV1, a window can be a sub-object of a button object eventhough CanDo does not allow this construct. The CD_ADE manualwarns that some combinations do not work and encourages theprogrammer to experiment. Also, cards can have multiple windowsrather than the one allowed by CanDo. As a novice BASICprogramming instructor I had in college used to say, "Try it andfind out. Try it and find out."Is CD_ADE Worth Buying?    CD_ADE can be obtained directly from Creative Logic for$49.95 + $3.00 S&H. I learned of the program in an advertisementin the pages of this magazine (AC 9.4, p. 69). I mailed my checkand received the software in exactly two weeks. The CD_ADEprogram, support files, and manual are on one disk. No printedmanual comes with the package. A second disk contains an AV1program named WordCross. This program can be used to examinesome of the techniques available in AV1. If you are a moderate toheavy user of CanDo, I believe you will want a copy of CD_ADE.Of course, it is possible that a future release of CanDo willhave some of the features of CD_ADE, but CD_ADE is available now,and there are no guarantees concerning new features in laterreleases of CanDo.    So what are you waiting for? Write that check and send itto:    Creative Logic    Attn: CD_ADE    POB 743271    Dallas, TX  75374-3271    Phone: (214) 432-9824    Fax: (214) 393-0007ÇU╚UUUUUUUU}UU> }}} @ }(Ç }@Ç}XÇ}`ÇÇÇ    }hÇ
  2. }pÇ ,